<div id="changePasswd" class="modal fade" role="dialog" aria-hidden="true" data-backdrop="static" >
    <div class="modal-dialog">
       <div class="modal-content">
          <div class="modal-header">
             <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
             <h4 class="modal-title">修改密码</h4>
          </div>
          <div class="modal-body">
			<!-- BEGIN REGISTRATION FORM -->
			<form class="forgetPasswd-form" action="${base}/admin/user!signup.action" method="post">
				<div class="form-group">
					<label class="control-label visible-ie8 visible-ie9">原始密码</label>
					<div class="input-icon">
						<i class="icon-lock"></i>
						<input class="form-control placeholder-no-fix" type="password" autocomplete="off" id = "old_password" placeholder="原始密码" name="opassword"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label visible-ie8 visible-ie9">新密码</label>
					<div class="input-icon">
						<i class="icon-lock"></i>
						<input class="form-control placeholder-no-fix" type="password" autocomplete="off" id="new_password" placeholder="密码" name="npassword"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label visible-ie8 visible-ie9">重复密码</label>
					<div class="controls">
						<div class="input-icon">
							<i class="icon-ok"></i>
							<input class="form-control placeholder-no-fix" type="password" autocomplete="off" id = "repeat_password" placeholder="重复密码" name="rnpassword"/>
						</div>
					</div>
				</div>
				<div class="form-group">
					<div class="alert alert-danger display-hide" id = "alert-danger">
                              	密码不一致
					</div>
				</div>
			</form>
			<!-- END REGISTRATION FORM -->
			</div>
			<div class="modal-footer">
             <button class="btn green" onclick= "return changePwd();">确定</button>
             <button class="btn" data-dismiss="modal">取消</button>
          </div>
       </div>
    </div>
 </div>
 <script>
	function changePwd(){
		var npwd = $("#new_password").val();
		var rnpwd = $("#repeat_password").val();
		var id = $("#UserId").val();
		if(npwd!=rnpwd){
			$("#alert-danger").removeClass("display-hide");
			return false;
		}else{
			$("#alert-danger").addClass("display-hide");
		}
      	$.ajax({
            type:"post",
            url:"/pims/admin/user!changePasswd.action",
            dataType:"json",
            data:"opwd="+$("#old_password").val()+"&npwd="+npwd+"&rnpwd="+rnpwd+"&id="+id,
            cache:false,
            beforeSend:function(XMLHttpRequest){
            },
            success:function(json){
            	result = json.result;
            	if(result){
            		alert("修改成功");
            		$('#changePasswd').modal('hide');
            	}else{
            		alert("原始密码不正确");
            	}
            },
           	complete:function(XMLHttpRequest,textStatus){
           	},
          	error:function(XMLHttpRequest,textStatus,errorThrown){
                   alert("网络错误");
          	}
        });
        return false;
      }
</script>